package com.yunhe.servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.ibatis.session.SqlSession;

import com.yunhe.bean.OrderDetailedInfo;
import com.yunhe.bean.Page_2;
import com.yunhe.inter.OrderDetailedInfoInter;
import com.yunhe.util.SqlSessionFactoryUtil;

/**
 * 用于评价页面显示商品信息
 */
@WebServlet("/EvaluateServlet")
public class EvaluateServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  
    public EvaluateServlet() {
        super();
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Integer commodityID = Integer.parseInt(request.getParameter("commodityID")) ;
		//建立数据库连接
				SqlSession sqlSession =SqlSessionFactoryUtil.openSqlSession();
				OrderDetailedInfoInter mapper = sqlSession.getMapper(OrderDetailedInfoInter.class);
				
				
				OrderDetailedInfo odi = mapper.showOrderInfo(1, commodityID);
				request.setAttribute("odi", odi);
				request.setAttribute("commodityID", commodityID);
				sqlSession.close();
				request.getRequestDispatcher("/evaluate.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request,response);
	}

}
